using System.Data;
using ET;
namespace DA
{
	public class Schedule_DAL
	{
	private clsConnect cls = new clsConnect();

	#region Getdata
	public DataTable BindGirdtb_Schedule(string keywords)
	{
	return cls.Search("sp_tb_Schedule_Search", "@KeyWords", keywords);
	}
    //public DataTable BindGirdtb_ScheduleDetail(int id)
    //{
    //}
	#endregion

	#region Insert
	public bool Inserttb_Schedule(Schedule_ET data)
	{
	cls.CreateNewSqlCommand();
	cls.AddParameter("@Schedule_Title", data.Schedule_Title);
	cls.AddParameter("@Schedule_Date", data.Schedule_Date);
	cls.AddParameter("@Schedule_Time_Start", data.Schedule_Time_Start);
	cls.AddParameter("@Schedule_Time_End", data.Schedule_Time_End);
	cls.AddParameter("@Schedule_Address", data.Schedule_Address);
	cls.AddParameter("@District_ID", data.District_ID);
	cls.AddParameter("@Schedule_Type_ID", data.Schedule_Type_ID);
	cls.AddParameter("@Schedule_Content", data.Schedule_Content);
	cls.AddParameter("@Schedule_Content_Prepare", data.Schedule_Content_Prepare);
	cls.AddParameter("@Schedule_Color", data.Schedule_Color);
	cls.AddParameter("@Schedule_Priority", data.Schedule_Priority);
	cls.AddParameter("@Contact_ID", data.Contact_ID);
	cls.AddParameter("@Schedule_Date_Number", data.Schedule_Date_Number);
	cls.AddParameter("@Schedule_Cancel", data.Schedule_Cancel);
	cls.AddParameter("@Schedule_Reason", data.Schedule_Reason);
	cls.AddParameter("@Schedule_User_Add", data.Schedule_User_Add);
	cls.AddParameter("@Schedule_Date_Add", data.Schedule_Date_Add);
	cls.AddParameter("@Schedule_Computer_Add", data.Schedule_Computer_Add);
	cls.AddParameter("@Schedule_User_Modify", data.Schedule_User_Modify);
	cls.AddParameter("@Schedule_Date_Modify", data.Schedule_Date_Modify);
	cls.AddParameter("@Schedule_Computer_Modify", data.Schedule_Computer_Modify);
	cls.ExecuteNonQuery("sp_tb_Schedule_Insert");
	return true;
	}
	#endregion

	#region Update
	public bool Updatetb_Schedule(Schedule_ET data)
	{
	cls.CreateNewSqlCommand();
	cls.AddParameter("@Schedule_ID", data.Schedule_ID);
	cls.AddParameter("@Schedule_Title", data.Schedule_Title);
	cls.AddParameter("@Schedule_Date", data.Schedule_Date);
	cls.AddParameter("@Schedule_Time_Start", data.Schedule_Time_Start);
	cls.AddParameter("@Schedule_Time_End", data.Schedule_Time_End);
	cls.AddParameter("@Schedule_Address", data.Schedule_Address);
	cls.AddParameter("@District_ID", data.District_ID);
	cls.AddParameter("@Schedule_Type_ID", data.Schedule_Type_ID);
	cls.AddParameter("@Schedule_Content", data.Schedule_Content);
	cls.AddParameter("@Schedule_Content_Prepare", data.Schedule_Content_Prepare);
	cls.AddParameter("@Schedule_Color", data.Schedule_Color);
	cls.AddParameter("@Schedule_Priority", data.Schedule_Priority);
	cls.AddParameter("@Contact_ID", data.Contact_ID);
	cls.AddParameter("@Schedule_Date_Number", data.Schedule_Date_Number);
	cls.AddParameter("@Schedule_Cancel", data.Schedule_Cancel);
	cls.AddParameter("@Schedule_Reason", data.Schedule_Reason);
	cls.AddParameter("@Schedule_User_Add", data.Schedule_User_Add);
	cls.AddParameter("@Schedule_Date_Add", data.Schedule_Date_Add);
	cls.AddParameter("@Schedule_Computer_Add", data.Schedule_Computer_Add);
	cls.AddParameter("@Schedule_User_Modify", data.Schedule_User_Modify);
	cls.AddParameter("@Schedule_Date_Modify", data.Schedule_Date_Modify);
	cls.AddParameter("@Schedule_Computer_Modify", data.Schedule_Computer_Modify);
	cls.ExecuteNonQuery("sp_tb_Schedule_Update");
	return true;
	}
	#endregion

	#region Delete
	public bool Deletetb_Schedule(int id)
	{
        cls.Delete("sp_tb_Schedule_Delete", "@Schedule_ID", id);
	return true;
	}
	#endregion
	}
}